<?php

/*
|--------------------------------------------------------------------------
| Application Routes
|--------------------------------------------------------------------------
|
| Here is where you can register all of the routes for an application.
| It's a breeze. Simply tell Laravel the URIs it should respond to
| and give it the controller to call when that URI is requested.
|
*/

Route::get('/', function () {
    return view('nidaye');
});


Route::get('/wo', function () {
    return view('welcome');
});

Route::get('/config',function(){

	echo Config::get('app.timezone');

});

Route::get('/env',function(){
	echo env('APP_KEY');
});

Route::post('/postRoute',function(){
	echo '这是一个post路由';

});

Route::get('/getForm',function(){
	echo '<form method="post" action="/postRoute">';
	echo '<button type="submit"> 访问post路由</button>';
	echo csrf_field();
	echo '</form>';

});


Route::get('params/{name}/{sex}',function($name,$sex){
		echo $name;
		echo $sex;
})->WHERE('name','\d+');

Route::get('/user/action/delete/{id}',['as'=>'deleteuser',function($id){

	echo '你删除的用户为'.$id;
	
}]);


Route::get('/redirect',function(){
	
		return redirect()->route('deleteuser',['id'=>350]);

});

Route::group(['prefix'=>'home'],function(){


	//此处全是路由
	Route::get('/index',function(){
		echo '网站首页';
	});
	Route::get('/userInfo',function(){
		echo '用户信息更新';
	});
	Route::get('/goods',function(){
		echo '商品列表';
	});
	Route::get('/goodsInfo',function(){
		echo '商品信息';
	});
	
});

Route::get('/ajaxForm',function(){
	return view('ajaxForm');
});


Route::post('ajaxResult',function(){
	echo 'ajax请求成功!';
});








